﻿using System;
using System.Windows.Forms;

namespace Magitek.Settings
{
    public partial class HealingManagerForm : Form
    {
        public HealingManagerForm()
        {
            InitializeComponent();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            Magitek.WindowSettings.Save();
            this.Close();
        }
        private void HealingManagerForm_Load(object sender, EventArgs e)
        {
            lstDispel.DataSource = Magitek.WindowSettings._dispeList;
            txtHealDoubleCastTimer.Text = Magitek.WindowSettings.HealDoubleCastingTimer.ToString();
            txtTargetsToAOEHeal.Text = Magitek.WindowSettings.TargetsToAOEHeal.ToString();
            chkSoloMode.Checked = Magitek.WindowSettings.SoloMode;
            txtDispelAboveHp.Text = Magitek.WindowSettings.HealingDispelAboveHp.ToString();
            chkHealAlliance.Checked = Magitek.WindowSettings.HealEveryone;
            checkBox1.Checked = Magitek.WindowSettings.ToggleClericStance;
        }
        private void txtTargetsToAOEHeal_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtTargetsToAOEHeal.Text))
            {
                Magitek.WindowSettings.TargetsToAOEHeal = int.Parse(txtTargetsToAOEHeal.Text);
            }
        }
        private void txtHealDoubleCastTimer_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtHealDoubleCastTimer.Text))
            {
                Magitek.WindowSettings.HealDoubleCastingTimer = int.Parse(txtHealDoubleCastTimer.Text);
            }
        }
        private void chkSoloMode_CheckedChanged(object sender, EventArgs e)
        {
            Magitek.WindowSettings.SoloMode = chkSoloMode.Checked;
        }
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (lstDispel.SelectedItems.Count > 0)
            {
                Magitek.WindowSettings._dispeList.Remove((string) lstDispel.SelectedValue);
            }

        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Magitek.WindowSettings._dispeList.Add(txtAddDispel.Text);
            txtAddDispel.Clear();
        }
        private void txtDispelAboveHp_TextChanged(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtDispelAboveHp.Text))
            {
                Magitek.WindowSettings.HealingDispelAboveHp = int.Parse(txtDispelAboveHp.Text);
            }
        }
        private void chkHealAlliance_CheckedChanged(object sender, EventArgs e)
        {
            Magitek.WindowSettings.HealEveryone = chkHealAlliance.Checked;
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            Magitek.WindowSettings.ToggleClericStance = checkBox1.Checked;
        }
    }
}
